#include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>

using std::cin;
using std::cout;
using std::vector;

template <typename InputIterator, typename TKey>
InputIterator my_partition(InputIterator begin, InputIterator end, TKey key) {
    auto iter = begin;
    while (begin != end) {
        if (*begin < key) {
            iter_swap(iter, begin);
            ++iter;
        }
        ++begin;
    }
    return iter;
}

void input(vector <int> &lst, int &x) {
    int n;
    cin >> n;
    lst.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> lst[i];
    }
    cin >> x;
}

void output(int a, int b) {
    cout << a << '\n' << b;
}

int main() {
    int x;
    vector <int> lst;
    input(lst, x);
    auto iter = my_partition(lst.begin(), lst.end(), x);
    output(iter - lst.begin(), lst.end() - iter);
    return 0;
}
